package a入门.day5.数组;

public class 遍历数组 {
    public static void main(String[] args) {
        int[]arr={1,2,3,400,5,6,7,8,90,33,5455,66};
        System.out.println("数组一共元素数："+arr.length);
        for(int i=0;i<arr.length;i++){
            System.out.println(arr[i]);
        }
        System.out.println("==========倒序遍历==========");
        for(int i=arr.length-1;i>=0;i--){
            System.out.println(arr[i]);
        }
        System.out.println("-------统计偶数和--------");
        int even=0;
        int odd=0;
        for(int i=0;i<arr.length;i++){
            if(arr[i]%2==0){
                even+=arr[i];
            }else {
                odd+=arr[i];
            }
        }
        System.out.println("数组中偶数和："+even+",奇数和："+odd);
    }
}
